import {SocketUtils} from "../../socket/SocketUtils";
import * as proto from "../../socket/proto/proto";
import {model} from "./Model";
import {utils} from "../../utils/utils";

export class CommonResultModel extends cc.EventTarget {
  constructor() {
    super();
    SocketUtils.getLogicSocket().on(proto.CommonResult, (msg: proto.CommonResult) => {
      this.emit(msg.code.toString())
    })
  }

  onceSuccess(callback: Function) {
    model.commonResult.once('0', callback)
  }
}